#ifndef STACK_HPP
#define STACK_HPP

#include "../Common/Card.h"

/** Number of Decks in one Stack */
#define STACK_DECK_COUNT 5
/** Maximum number of cards on the Stack */
#define STACK_MAX_CARDS STACK_DECK_COUNT * 52

/**
 * Structure that defines a Stack of cards.
 * A stack consists of multiple decks in any random order.
 */
struct Stack
{
  /** All Cards in the Stack */
  Card Cards[STACK_MAX_CARDS];
  /** Array index of the next card that will be dealt */
  unsigned int Next;
};

typedef struct Stack Stack;

/**
 * Initialise the Stack with 5 decks in a defined order.
 * 1-52, 1-52, 1-52, 1-52, 1-52
 * @param stack Pointer to a Stack instance
 */
void stack_initialize(Stack *stack);

/**
 * Refills and shuffles the cards on the Stack.
 * @param stack Pointer to a Stack instance
 * @param times How often should the Stack be shuffled
 */
void stack_shuffle(Stack *stack, unsigned int times);

/**
 * Gets the next Card from the Stack.
 * @param stack Pointer to a Stack instance
 */
Card stack_next_card(Stack *stack);

/**
 * Returns the number of remaining Cards on the Stack
 * @param stack Pointer to a Stack instance
 */
unsigned int stack_remaining_cards(Stack *stack);

#endif
